package cn.apthink.mybatisplus.service.impl;

import cn.apthink.model.VDepartment;
import cn.apthink.mybatisplus.entity.DepartmentEntity;
import cn.apthink.mybatisplus.mapper.DepartmentMapper;
import cn.apthink.mybatisplus.service.DepartmentService;
import cn.apthink.utility.Util;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.solon.service.impl.ServiceImpl;

import java.util.List;

import org.noear.solon.annotation.Component;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author David唐
 * @since 2024-02-23
 */
@Component
public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, DepartmentEntity> implements DepartmentService {
	public List<DepartmentEntity> select(String departmentName, List<Integer> departmentTypes, List<Integer> scheduleTypes) {
		QueryWrapper<DepartmentEntity> q = new QueryWrapper<>();
		if (!Util.isEmpty(departmentName))
			q.like("departmentname", departmentName);
		if (!Util.isEmpty(departmentTypes)) {
			q.in("departmenttype", departmentTypes);
		}
		if (!Util.isEmpty(scheduleTypes)) {
			q.in("scheduletype", scheduleTypes);
		}
		return list(q);
	}
}
